package com.gzhryc.shared_device.oem.code.agent.dao.db;

import java.util.Date;

import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Join;
import com.gzhryc.jdbc.annotaion.PrimaryKey;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.shared_device.oem.code.user.ERoleType;
import com.gzhryc.shared_device.oem.code.user.dao.db.User;

/**
 * 代理关系
 * @version 2023-05-27
 */
@Table(name="agent_relation")
public class AgentRelation {

    @PrimaryKey
    @Column(name = "user_id", note = "主用户ID")
    protected Long userId;

    @PrimaryKey
    @Column(name = "relation_user_id", note = "关联用户ID")
    protected Long relationUserId;
    
    @Column(name = "role_type",notNull=true,defVal="98",note = "角色类型")
    protected Integer roleType;
    
    @Column(name = "can_undeploy_device",notNull = false, defVal = "0", note = "是否移除部署")
    protected Integer canUndeployDevice;

    @Column(length = 128,note = "备注")
    protected String note;

    @Column(name = "last_login_date",note = "登陆时间")
    protected Date lastLoginDate;

    @Column(name = "update_date", autoUpdateTime = true)
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    @Join(fromField = "relation_user_id")
    protected User relationUser;

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getRelationUserId() {
        return relationUserId;
    }

    public void setRelationUserId(Long relationUserId) {
        this.relationUserId = relationUserId;
    }
    
    public Integer getRoleType() {
		return roleType;
	}

	public void setRoleType(Integer roleType) {
		this.roleType = roleType;
	}
	
	public Integer getCanUndeployDevice() {
		return canUndeployDevice;
	}

	public void setCanUndeployDevice(Integer canUndeployDevice) {
		this.canUndeployDevice = canUndeployDevice;
	}

	public String getNote() {
        return note;
    }

    public void setNote(String note) {
        this.note = note;
    }

    public Date getLastLoginDate() {
        return lastLoginDate;
    }

    public void setLastLoginDate(Date lastLoginDate) {
        this.lastLoginDate = lastLoginDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public User getRelationUser() {
        return relationUser;
    }

    public void setRelationUser(User relationUser) {
        this.relationUser = relationUser;
    }
    
    public String getRoleTypeName() {
    	return ERoleType.note(this.roleType);
    }
}